package com.gewu.pm.ui.activity.customer;

import android.view.View;

import androidx.recyclerview.widget.RecyclerView;

import com.gewu.pm.app.AppAdapter;
import com.gewu.pm.bean.ManagementBean;
import com.gewu.pm.ui.activity.base.BaseManagementActivity;
import com.gewu.pm.ui.activity.filter.FilterDistributorActivity;
import com.gewu.pm.ui.adapter.customer.DeliveryProviderAdapter;

/**
 * 配送商管理
 */
public final class DeliveryProviderActivity extends BaseManagementActivity<ManagementBean> {

    @Override
    protected String getPageTitle() {
        return "配送商管理";
    }

    @Override
    protected String getSearchHint() {
        return "输入配送商简称/车辆编码";
    }

    @Override
    protected AppAdapter<ManagementBean> createAdapter() {
        return new DeliveryProviderAdapter(getContext());
    }

    @Override
    protected void loadData() {
        mDataList.clear();
        mDataList.add(new ManagementBean("杭州小配送1号车"));
        mDataList.add(new ManagementBean("杭州小配送2号车"));

        // 保存原始数据用于搜索
        setOriginalData(mDataList);
        
        mAdapter.setData(mDataList);
        updateEmptyView();
    }

    @Override
    protected String getSearchText(ManagementBean item) {
        // 搜索配送商名称（item 左上角的文字）
        return item.getName();
    }

    @Override
    protected void onFilterClick() {
        // 点击右上角筛选按钮
        //FilterPendingPaymentActivity.start(getActivity());
        FilterDistributorActivity.start(this);
    }

    @Override
    public void onItemClick(RecyclerView recyclerView, View itemView, int position) {
        ManagementBean item = mAdapter.getItem(position);
        // 跳转到配送商详情页面
        DeliveryProviderDetailsActivity.start(getContext(), item.getName());
    }
}
